package exception;

public class TryCatchFinallyDemo02 {
    public static void main(String[] args) {
        Integer a = null;
        int b = 0;
        int c = -1;
        try {
            int d = a.intValue(); //肯能会出现空指针异常
            c = a / b; //可能会出现算数异常
        //假如多个Catch中异常处理逻辑相同，也可以采用如下方式进行合并
        }catch (NullPointerException | ArithmeticException e1){
            c++;
        }finally {
            c++;
        }
        System.out.println(c);
    }
}
